//
//  OneViewController.m
//  WYModel
//
//  Created by ios on 2017/3/2.
//  Copyright © 2017年 Wy. All rights reserved.
//

#import "OneViewController.h"
#import "DeatilViewController.h"
#import "Person.h"
#import "TypeScrollView.h"
#import "UserHeadView.h"

@interface OneViewController ()<UISearchBarDelegate>

@property(nonatomic,strong) UserHeadView *userHeaderView;

@end

@implementation OneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = WYCOLOR(200, 200, 200, 1.0);
  
   self.automaticallyAdjustsScrollViewInsets = NO; //如果ScrollerView为第一个控制器添加的View
//    
    TypeScrollView  *typeView = [[TypeScrollView alloc] initWithFrame:CGRectMake(0, 400, kWidth, kWidth/5)];
//
    [typeView addItemData:@[@"推荐",@"健身",@"职场",@"母婴",@"时尚"] andImageData:@[@"type-1",@"type-2",@"type-3",@"type-4",@"type-5"]];
    
    typeView.block = ^(NSString *title,NSInteger index){
        WYLog(@"show%@----%ld",title,index);
        
    };
    
    [self.view addSubview:typeView];
    
    
    [self.view addSubview:self.userHeaderView];
    
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    [self.navigationController pushViewController:[[DeatilViewController alloc] init] animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(UserHeadView *)userHeaderView{
   
    if (!_userHeaderView) {
        
        _userHeaderView = [[UserHeadView alloc] initWithFrame:CGRectMake(0, 64, kWidth, kWidth/2)];
     // [_userHeaderView setUserImage:[NSString stringWithFormat:@""] nickName:@"似水年华"];
    }
    
    return _userHeaderView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
